package cn.edu.usst.cs.goldfish.booking.meetingroom.util;

import cn.edu.usst.cs.goldfish.booking.meetingroom.handler.GoldfishBookingException;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CommonUtil {
    public void ensureEqual(
            Object value,
            @NonNull
            Object expectedValue,
            String message
    ) {
        if (expectedValue.equals(value))
            return;
        log.error("{} [{}] - {}[{}] 不匹配",
                value, value == null ? "" : value.getClass(),
                expectedValue, expectedValue.getClass()
        );
        throw new GoldfishBookingException(message);
    }
}
